﻿<UserControl x:Class="SLAudioDemo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="#FF333333">
        <Border>
            <Border.Background>
                <RadialGradientBrush Center="0.5,-0.212" GradientOrigin="0.5,-0.212" RadiusX="0.742" RadiusY="0.4">
                    <GradientStop Color="#FF5B5B5B" Offset="0.009" />
                    <GradientStop Color="#FF1E1E1E" Offset="1" />
                </RadialGradientBrush>
            </Border.Background>
            <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF4B4B4B" Offset="0" />
                    <GradientStop Color="#FF343434" Offset="0.039" />
                </LinearGradientBrush>
            </Border.BorderBrush>
            <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                <TextBlock Foreground="White" FontSize="20" Text="Webcam and Microphone Sample" Margin="15" HorizontalAlignment="Center" />
                <Border Width="320" Height="240" CornerRadius="10">
                    <Border.Effect>
                        <DropShadowEffect Color="White" Direction="0" ShadowDepth="0" BlurRadius="25"/>
                    </Border.Effect>
                    <Rectangle x:Name="WebcamCapture" Width="320" Height="240" Fill="White"/>
                </Border>

                <Grid Width="500">

                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="250" />
                        <ColumnDefinition Width="250" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Margin="5" HorizontalAlignment="Center" Foreground="White" Text="Available AUDIO Sources" Grid.Column="0" Grid.Row="0" />
                    <ListBox x:Name="AudioSources" Grid.Row="1" Grid.Column="0">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding FriendlyName}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                    <TextBlock Margin="5" HorizontalAlignment="Center" Foreground="White" Text="Available VIDEO Sources" Grid.Column="1" Grid.Row="0" />
                    <ListBox x:Name="VideoSources" Grid.Row="1" Grid.Column="1">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding FriendlyName}" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                    <Button Click="CaptureButton_Click" Margin="5" x:Name="CaptureButton" Content="Start Capture" Height="35" Style="{StaticResource ButtonStyle}" />
                    <Button Click="StopCapture_Click" Margin="5" x:Name="StopCapture" Content="Stop Capture" Height="35" Style="{StaticResource ButtonStyle}" />
                    <Button Click="TakeSnapshot_Click" Margin="5" x:Name="TakeSnapshot" Content="Take Snapshot" Height="35" Style="{StaticResource ButtonStyle}" />
                    <Button Click="SaveAudio_Click" Margin="5" x:Name="SaveAudio" Content="Save Audio" Height="35" Style="{StaticResource ButtonStyle}" />
                </StackPanel>
                <ScrollViewer Width="400" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Auto">
                    <ItemsControl x:Name="Snapshots">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Image Source="{Binding}" Margin="5" Stretch="UniformToFill" Height="50" />
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </ItemsControl>
                </ScrollViewer>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
